package cn.tedu.exercise;

import java.util.Arrays;

public class BubleSort {
    public static void main(String[] args) {
        int[] a={100,35,69,23,45,9};
        int[] newA= method(a);
        System.out.println("排序完毕"+ Arrays.toString(newA));
    }
    public static int[] method(int[] a) {
        for (int i=1;i<=a.length-1;i++){
            for (int j=0;j<a.length-i;j++){
                int b;
                if (a[j] > a[j+1]){
                    b=a[j];
                    a[j]=a[j+1];
                    a[j+1]=b;
                }
            }
            System.out.println("第"+i+"轮结果"+Arrays.toString(a));
        }
        return a;
    }
}
